Setting up layouts and links

jamesperet 11 anni fa
parent
commit
a2e528e0d4

+ 1 - 0
app/assets/stylesheets/application.css

@@ -9,5 +9,6 @@
9 9
  * compiled file, but it's generally better to create a new file per style scope.
10 10
  *
11 11
  *= require_self
12
+ *= require flatstrap/bootstrap
12 13
  *= require_tree .
13 14
  */

+ 2 - 1
app/assets/stylesheets/bootstrap_and_overrides.css.less

@@ -1,4 +1,5 @@
1
-@import "twitter/bootstrap/bootstrap";
1
+//@import "twitter/bootstrap/bootstrap";
2
+
2 3
 @import "twitter/bootstrap/responsive";
3 4
 
4 5
 // Set the correct sprite paths

+ 3 - 0
app/controllers/start_controller.rb

@@ -1,4 +1,7 @@
1 1
 class StartController < ApplicationController
2
+  
3
+  layout 'front_end'
4
+  
2 5
   def index
3 6
   end
4 7
 

+ 4 - 4
app/views/layouts/application.html.erb

@@ -46,12 +46,12 @@
46 46
             <span class="icon-bar"></span>
47 47
             <span class="icon-bar"></span>
48 48
           </a>
49
-          <a class="brand" href="#">AvalancheGame</a>
49
+          <a class="brand" href="/">Avalanche Game</a>
50 50
           <div class="container-fluid nav-collapse">
51 51
             <ul class="nav">
52
-              <li><%= link_to "Link1", "/path1"  %></li>
53
-              <li><%= link_to "Link2", "/path2"  %></li>
54
-              <li><%= link_to "Link3", "/path3"  %></li>
52
+              <li><%= link_to "About", start_about_path  %></li>
53
+              <li><%= link_to "Login", new_user_session_path  %></li>
54
+              <li><%= link_to "Sign Up", new_user_registration_path  %></li>
55 55
             </ul>
56 56
           </div><!--/.nav-collapse -->
57 57
         </div>

+ 87 - 0
app/views/layouts/auth.html.erb

@@ -0,0 +1,87 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+  <head>
4
+    <meta charset="utf-8">
5
+    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
6
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+    <title><%= content_for?(:title) ? yield(:title) : "AvalancheGame" %></title>
8
+    <%= csrf_meta_tags %>
9
+
10
+    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
11
+    <!--[if lt IE 9]>
12
+      <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script>
13
+    <![endif]-->
14
+
15
+    <%= stylesheet_link_tag "application", :media => "all" %>
16
+
17
+    <!-- For third-generation iPad with high-resolution Retina display: -->
18
+    <!-- Size should be 144 x 144 pixels -->
19
+    <%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
20
+
21
+    <!-- For iPhone with high-resolution Retina display: -->
22
+    <!-- Size should be 114 x 114 pixels -->
23
+    <%= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %>
24
+
25
+    <!-- For first- and second-generation iPad: -->
26
+    <!-- Size should be 72 x 72 pixels -->
27
+    <%= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %>
28
+
29
+    <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
30
+    <!-- Size should be 57 x 57 pixels -->
31
+    <%= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %>
32
+
33
+    <!-- For all other devices -->
34
+    <!-- Size should be 32 x 32 pixels -->
35
+    <%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %>
36
+
37
+    <%= javascript_include_tag "application" %>
38
+  </head>
39
+  <body>
40
+
41
+    <div class="navbar navbar-fixed-top">
42
+      <div class="navbar-inner">
43
+        <div class="container">
44
+          <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
45
+            <span class="icon-bar"></span>
46
+            <span class="icon-bar"></span>
47
+            <span class="icon-bar"></span>
48
+          </a>
49
+          <a class="brand" href="#">AvalancheGame</a>
50
+          <div class="container nav-collapse">
51
+            <ul class="nav">
52
+              <li><%= link_to "Link1", "/path1"  %></li>
53
+              <li><%= link_to "Link2", "/path2"  %></li>
54
+              <li><%= link_to "Link3", "/path3"  %></li>
55
+            </ul>
56
+          </div><!--/.nav-collapse -->
57
+        </div>
58
+      </div>
59
+    </div>
60
+
61
+    <div class="container">
62
+        <div class="row">
63
+          <div class="span9">
64
+            <%= bootstrap_flash %>
65
+            <%= yield %>
66
+          </div>
67
+          <div class="span3">
68
+            <div class="well sidebar-nav">
69
+              <h3>Sidebar</h3>
70
+              <ul class="nav nav-list">
71
+                <li class="nav-header">Sidebar</li>
72
+                <li><%= link_to "Link1", "/path1"  %></li>
73
+                <li><%= link_to "Link2", "/path2"  %></li>
74
+                <li><%= link_to "Link3", "/path3"  %></li>
75
+              </ul>
76
+            </div><!--/.well -->
77
+          </div><!--/span-->
78
+        </div><!--/row-->
79
+
80
+      <footer>
81
+        <p>&copy; Company 2014</p>
82
+      </footer>
83
+
84
+    </div> <!-- /container -->
85
+
86
+  </body>
87
+</html>

+ 87 - 0
app/views/layouts/front_end.html.erb

@@ -0,0 +1,87 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+  <head>
4
+    <meta charset="utf-8">
5
+    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
6
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+    <title><%= content_for?(:title) ? yield(:title) : "AvalancheGame" %></title>
8
+    <%= csrf_meta_tags %>
9
+
10
+    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
11
+    <!--[if lt IE 9]>
12
+      <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script>
13
+    <![endif]-->
14
+
15
+    <%= stylesheet_link_tag "application", :media => "all" %>
16
+
17
+    <!-- For third-generation iPad with high-resolution Retina display: -->
18
+    <!-- Size should be 144 x 144 pixels -->
19
+    <%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
20
+
21
+    <!-- For iPhone with high-resolution Retina display: -->
22
+    <!-- Size should be 114 x 114 pixels -->
23
+    <%= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %>
24
+
25
+    <!-- For first- and second-generation iPad: -->
26
+    <!-- Size should be 72 x 72 pixels -->
27
+    <%= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %>
28
+
29
+    <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
30
+    <!-- Size should be 57 x 57 pixels -->
31
+    <%= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %>
32
+
33
+    <!-- For all other devices -->
34
+    <!-- Size should be 32 x 32 pixels -->
35
+    <%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %>
36
+
37
+    <%= javascript_include_tag "application" %>
38
+  </head>
39
+  <body>
40
+
41
+    <div class="navbar navbar-fixed-top">
42
+      <div class="navbar-inner">
43
+        <div class="container">
44
+          <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
45
+            <span class="icon-bar"></span>
46
+            <span class="icon-bar"></span>
47
+            <span class="icon-bar"></span>
48
+          </a>
49
+          <a class="brand" href="/">Avalanche Game</a>
50
+          <div class="container nav-collapse">
51
+            <ul class="nav">
52
+              <li><%= link_to "About", start_about_path  %></li>
53
+              <li><%= link_to "Login", new_user_session_path  %></li>
54
+              <li><%= link_to "Sign Up", new_user_registration_path  %></li>
55
+            </ul>
56
+          </div><!--/.nav-collapse -->
57
+        </div>
58
+      </div>
59
+    </div>
60
+
61
+    <div class="container" style="margin-top: 60px;">
62
+        <div class="row">
63
+          <div class="span9">
64
+            <%= bootstrap_flash %>
65
+            <%= yield %>
66
+          </div>
67
+          <div class="span3">
68
+            <div class="well sidebar-nav">
69
+              <h3>Sidebar</h3>
70
+              <ul class="nav nav-list">
71
+                <li class="nav-header">Sidebar</li>
72
+                <li><%= link_to "Link1", "/path1"  %></li>
73
+                <li><%= link_to "Link2", "/path2"  %></li>
74
+                <li><%= link_to "Link3", "/path3"  %></li>
75
+              </ul>
76
+            </div><!--/.well -->
77
+          </div><!--/span-->
78
+        </div><!--/row-->
79
+
80
+      <footer>
81
+        <p>&copy; Company 2014</p>
82
+      </footer>
83
+
84
+    </div> <!-- /container -->
85
+
86
+  </body>
87
+</html>

+ 8 - 1
config/routes.rb

@@ -5,7 +5,14 @@ AvalancheGame::Application.routes.draw do
5 5
   get "agent/agent_profile"
6 6
   resources :missions
7 7
 
8
-  devise_for :users
8
+  devise_for :users, :skip => [:sessions, :registrations]
9
+    as :user do
10
+      get 'login' => 'devise/sessions#new', :as => :new_user_session
11
+      post 'login' => 'devise/sessions#create', :as => :user_session
12
+      delete 'logout' => 'devise/sessions#destroy', :as => :destroy_user_session
13
+      get   'signup' => 'devise/registrations#new',    :as => :new_user_registration
14
+      post  'signup' => 'devise/registrations#create', :as => :user_registration
15
+    end
9 16
   # The priority is based upon order of creation: first created -> highest priority.
10 17
   # See how all your routes lay out with "rake routes".
11 18